﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;

using Microsoft.Extensions.DependencyInjection;

namespace Microsoft.Extensions.DependencyInjection
{
    public static class UtilsServiceExtensions
    {
        private static Timer Timer;
   
        public static IServiceCollection AddAutoGC(this IServiceCollection services, TimeSpan period)
        {
            Timer = new Timer(Callback, null, period, period);
            return services;
        }

        public static void Callback(object obj)
        {
            GC.Collect();
        }
 
    }
}
